<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAgentOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('agent_orders', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('agent_user_id')     ->default(0)   ->comment('agent_user_id');
            $table->bigInteger('son_agent_user_id') ->default(0)   ->comment('son_agent_user_id');
            $table->bigInteger('buyer_user_id')     ->default(0)   ->comment('buyer_user_id');
            $table->string('order_num')             ->default('')  ->comment('order_num');
            $table->decimal('agent_fee')            ->default(0)   ->comment('结算费用');
            $table->integer('status')               ->default(0)   ->comment('0待处理，1通过，2失败');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('agent_orders');
    }
}
